<?php
global $base_dir;
$base_dir='../';

/**** 模块调用*****/
include_once($base_dir."inc/inc_connect.php");		//通用函数包含文件
include_once("index_inc.php");
include_once("func/function.php");
include_once($base_dir."inc/manage.php");			//后台通用包含文件
?>
<?php
//接收参数
if(is_array($_GET))
{
	foreach($_GET as $key => $value)
	{
		$$key=$value;
	}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $lanmu_name;?>-后台管理系统</title>
<link href="../style/common.css" rel="stylesheet" type="text/css" />
<script src="../js/checkform.js" type="text/javascript"></script>

<link href="../js/dq_calendar/dq_calendar.css" rel="stylesheet" type="text/css" />
<script src="../js/dq_calendar/dq_calendar.js" type="text/javascript"></script>

<script type="text/javascript">
//删除确认
function delConfig(url,str)
{
	if(confirm(str))
	{
		location.href=url;
	}
}
</script>
</head>
<body>
<form name="sortF" method="post" action="index_sort.php?do=sort">
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="lanmu_table">
	
  <tr>
    <td height="30" valign="bottom">
      <a href="<?php echo $url_list;?>">
      <span class="lanmu_title"><?php echo $lanmu_name;?></span></a>
      <span class="lanmu_title2">&nbsp;&gt;&nbsp;列表</span></td>
  </tr>
</table>

<!-- <table width="100%" border="0" cellpadding="0" cellspacing="0" class="margintop30_l">
<form action="" method="get" name="search">
  <tr>
    <td height="30" class="search"><strong>搜索:&nbsp;</strong>景点名称<input name="Att_name" title="请输入景点名称" type="text" value="<?=$_GET['Att_name']?>" /><input type="submit" name="Submit" value="提交" /></td>
  </tr>
  </form>
</table>
 -->
<?php
$pagesize=20;
$t=new Tbl_Act($tbl_name,$tbl_key);		//创建表对象
//$t->printsql=1;

//构建查询条件

$query_conv='where 1';

//搜索条件开始
/** sample
模糊查询搜索
$inputname='表单名';
$paramname='字段名';
if($$inputname!='')
{
	$t->$paramname=$$inputname;
	$query_conv.=" and $paramname like '%".$$inputname."%'";
	$query_conv2[]=$paramname.',like';					
}
精确查询搜索
$inputname='表单名';
$paramname='字段名';
if($$inputname!='')
{
	$t->$paramname=$$inputname;
	$query_conv.=" and $paramname='".$$inputname."'";
	$query_conv2[]=$paramname.',=';					
}	//这里两个条件代表的意思是一样的，第二种为数据库类需要的格式
*/

//景点名称模糊搜索
$inputname='';
$paramname='';
$query_conv2[] = '';
if($paramname!='') {
	$t->$paramname=$inputname;
	$query_conv.=" and $paramname like '%".$inputname."%'";
	$query_conv2[]=$paramname.',like';					
}
//搜索条件结束

//计算记录数量
$rs_num=$t->RsCount($query_conv2);
$pages=ceil($rs_num/$pagesize);
$page = 0;
if($page>$pages)
{
	$page=$pages;
}
if($page<1)
{
	$page=1;
}

$sql_limit=" limit ".($page-1)*$pagesize.",$pagesize";
//$t->printsql=1;
$rows=$t->GetAll('*',$query_conv.' order by  Att_sort ,'.$tbl_key.' desc'.$sql_limit);		//排序方式在此设置
?>
<table border="0" cellpadding="0" cellspacing="1" bgcolor="#999999" class="margintop30_l">
<tr>
    <tr>
    <td height="25" colspan="8" align="left" bgcolor="#FFFFFF" style="border:none; height:30px; padding-left:10px;" ><input type="submit" value="保存排序" style=" background:#0080C0; color:#FFF; border:none;" /></td>
  </tr>
  <tr>
  	<td width="80" height="25" align="center" class="title01">编号</td>
  	<td width="150" height="25" align="center" class="title01">景点名称</td>
  	<td width="100" height="25" align="center" class="title01">开始时间</td>
  	<td width="100" height="25" align="center" class="title01">结束时间</td>
  	<td width="100" height="25" align="center" class="title01">添加时间</td>
  	<td width="100" height="25" align="center" class="title01">缩略图</td>
	<td width="100" height="25" align="center" class="title01">排序</td>
    <td width="100" height="25" align="center" class="title01"><a href="<?=$url_add?>?<?=QueryString()?>" style="color:#C23734">增加记录</a></td>
  </tr>
<?php
if(is_array($rows) && count($rows)>0)
{
	foreach($rows as $key => $row)
	{
		$td_id=$row[$tbl_key];
		$td_op='<a href="../ticket/index.php?attId='.$td_id.'" style="color:#FF0000" target="mainFrame">门票</a>&nbsp;&nbsp;<a target="mainFrame" href="'.$url_mod.'?id='.$td_id.'&'.QueryString().'">修改</a>&nbsp;&nbsp;<a target="mainFrame" href="javascript:delConfig(\''.$url_act.'?act=del&'.$tbl_key.'='.$td_id.'\',\'确定删除？\')">删除</a>';
		$td0=$row["Att_name"];
		$td1=$row["Att_starttime"]>0?date("Y-m-d",$row["Att_starttime"]):'-';
		$td2=$row["Att_endtime"]>0?date("Y-m-d",$row["Att_endtime"]):'-';
		$td3=$row["Att_createtime"]>0?date("Y-m-d",$row["Att_createtime"]):'-';
		$td4=$row["Att_img"];

?>
  <tr>
    <td height="25" bgcolor="#FFFFFF" class="list_td"><?=$td_id?></td>
    <td height="25" bgcolor="#FFFFFF" class="list_td"><?=$td0?></td>
    <td height="25" align="center" bgcolor="#FFFFFF" class="list_td"><?=$td1?></td>
    <td height="25" align="center" bgcolor="#FFFFFF" class="list_td"><?=$td2?></td>
    <td height="25" align="center" bgcolor="#FFFFFF" class="list_td"><?=$td3?></td>
    <td height="25" align="center" bgcolor="#FFFFFF" class="list_td"><?=empty($td4)?'-':'<img width="100" height="80" src="..'.$td4.'">'?></td>
	<td height="25" align="center" bgcolor="#FFFFFF" class="list_td"><input type="text" name="sort[<?php echo $td_id;?>]" value="<?php echo $row['Att_sort'];?>" style="width:80px; height:22px; line-height:22px;" /></td>
    <td height="25" align="center" bgcolor="#FFFFFF" class="list_td"><?=$td_op?></td>
  </tr>
<?php
	}
?>  
  <tr>
    <td height="25" colspan="8" align="right" bgcolor="#FFFFFF">
	<?php
	$helfstyle='?page=@';
	if(is_array($_GET))
	{
		foreach($_GET as $key => $value)
		{
			if($key=='page')
			{
				continue;
			}
			$helfstyle.='&'.$key.'='.$value;
		}
	}
	echo getPageNum($page,$pages,5,$helfstyle);
	?>
	&nbsp;</td>
  </tr>
  
<?php
}
else
{
?>
	<tr>
    	<td height="25" colspan="7" align="center" bgcolor="#FFFFFF">暂无内容&nbsp;...</td>
	</tr>
<?php
}
?>
</table>
</form>
<!-- 7caihu.com Baidu tongji analytics -->
<script type="text/javascript">
var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");

document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3Fb8797ecb21d1ccb839c35b190277a0cd' type='text/javascript'%3E%3C/script%3E"));

</script>
</body>
</html>
<?php
include_once($base_dir."inc/inc_unconnect.php")
?>